package com.sbj.dto.res;

import cn.zhxu.bs.bean.DbField;
import cn.zhxu.bs.bean.SearchBean;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * @author summer
 * @version 1.0
 * @date 2024/8/10 14:35
 */
@Data
@SearchBean(tables = " buy_goods b   LEFT JOIN member  m on b.member_id = m.id",autoMapTo = "b",orderBy = "b.createTime DESC")
public class BuyRes implements Serializable {

    @DbField("b.id")
    private Integer id;

    @DbField("b.goods_name")
    private String goodsName;

    @DbField("b.goods_price")
    private BigDecimal goodsPrice;


    @DbField("b.goods_num")
    private Integer goodsNum;

    @DbField("CASE WHEN b.grounding=0 THEN '平台' ELSE '会员' END")
    private String groundingName;

    @DbField("b.member_id")
    private Integer memberId;

    @DbField("m.nickName")
    private String memberName;

    @DbField("b.createTime")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private LocalDateTime createTime;

    @DbField("b.goods_image")
    private String goodsImage;

    @DbField("b.status")
    private Integer status;

    @DbField("CASE WHEN b.status=0 THEN '未出售' ELSE '出售' END")
    private String statusName;
}
